package com.hdoit.kylin.web.baseInfo.providers;

import java.util.ArrayList;
import java.util.List;

import com.hdoit.kylin.logical.baseInfo.model.Term;
import com.hdoit.kylin.logical.baseInfo.service.ITermService;
import com.tennetcn.common.aop.CommonApplicationContextUtil;
import com.tennetcn.common.message.ListItem;
import com.tennetcn.component.attribute.provider.ISingleOptionListProvider;
import com.tennetcn.web.cbase.providers.base.DataListProviderBase;

public class TermProvider extends DataListProviderBase implements ISingleOptionListProvider<ListItem>{

	@Override
	public List<ListItem> getDataList(Object viewData) {
		dataList = new ArrayList<ListItem>();
		
		ITermService termService = CommonApplicationContextUtil.getCurrentContext().getBean(ITermService.class);
		List<Term> terms = termService.queryList();
		for(Term term:terms){
			ListItem listItem = new ListItem();
			listItem.setValue(term.getTermId());
			listItem.setText(term.getTermName());
			dataList.add(listItem);
		}
		return dataList;
	}
	
	

}
